package com.darren.archive.entity;

import com.darren.framework.entity.BaseEntity;
import com.darren.framework.utils.Constant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.annotations.SQLDelete;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 角色和功能关联实体
 */
@ApiModel(value = "角色和功能关联")
@Entity
@Table(name = Constant.TABLE_NAME_PREV + "role_function")
@SQLDelete(sql = "update " + Constant.TABLE_NAME_PREV + "role_function set is_delete = true,version=version+1 where id=? and version=?", check = ResultCheckStyle.COUNT)
public class SysRoleFunction extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -9129824707735331099L;

    /**
     * 角色id
     */
    @ApiModelProperty(notes = "角色id")
    @Column(name = "role_id", columnDefinition = "bigint not null comment '角色id'")
    private Long roleId;

    /**
     * 功能id
     */
    @ApiModelProperty(notes = "功能id")
    @Column(name = "function_id", columnDefinition = "bigint not null comment '功能id'")
    private Long functionId;

    @ApiModelProperty(notes = "角色赋权时，树结点的勾选状态：0 未勾选，1 半勾选，2 选中")
    @Column(name = "checked_status", columnDefinition = "tinyint  null default 0 comment '角色赋权时，树结点的勾选状态：0 未勾选，1 半勾选，2 选中'")
    private Integer checkedStatus = 0;

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Long getFunctionId() {
        return functionId;
    }

    public void setFunctionId(Long functionId) {
        this.functionId = functionId;
    }

    public Integer getCheckedStatus() {
        return checkedStatus;
    }

    public void setCheckedStatus(Integer checkedStatus) {
        this.checkedStatus = checkedStatus;
    }
}